<?php
/**
 * ===============================================
 * 版权所有 2019-2050 青岛铁锤科技有限公司，并保留所有权利。
 * 网站地址: http://www.huaxianling.com
 * ===============================================
 * Author: Rag Hu
 * Created Time: 2019/7/27 13:57
 * Modified Time: 2019/7/27 13:57
 * Version: 2.0
 */

namespace App\Modules\Partner\Criterias;


use App\Lib\Facades\FLAuth;
use Flower\Core\Repository\Contracts\RepositoryInterface;
use Flower\Core\Repository\Criterias\BaseCriterias;

class GetUserAccountCriteria extends BaseCriterias
{
    public function apply($model, RepositoryInterface $repository)
    {
        $user_id = FLAuth::id();

        $model = $model
            ->select([
                'bonus_amount',
                'city.name',
                'ranking',
                'share'
            ])
            ->leftJoin('city', 'city', 'city.code')
            ->where('user_id', $user_id);

        return $model;
    }
}